<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>
	<link type="text/css" rel="stylesheet" href="cupertino/estilo.css" />
	<script src="js/calendario.js" type="text/javascript" />
</h:head>
<h:body>


	<h:form id="form">
		<p:growl showDetail="true" />
		<p:panel id="panel" header="Cadastro">

			<h:panelGrid columns="3">

				<h:outputLabel for="nome" value="Nome: " />
				<p:inputText id="nome" value="#{usuarioBean.usuario.nome}"
					requiredMessage="O nome é obrigatório" required="true" />
				<p:message for="nome" id="msgValidacaoNome" />

				<h:outputLabel for="email" value="Email: " />
				<p:inputText id="email" value="#{usuarioBean.usuario.email}"
					requiredMessage="O email é obrigatório" required="true" />
				<p:message for="email" id="msgValidacaoEmail" />

				<h:outputLabel for="data" value="Data: " />
				<p:calendar id="data" pattern="dd/MM/yyyy" locale="pt_BR"
					value="#{usuarioBean.usuario.nascimento}"
					requiredMessage="A data é obrigatório" required="true" />
				<p:message for="data" id="msgValidacaoData" />
				<p:commandButton value="Salvar" action="#{usuarioBean.salvar}"
					update="@form" />
			</h:panelGrid>
			
		
			
		</p:panel>
		


		<p:dataTable value="#{usuarioBean.usuarios}" var="usuario"
			paginator="true" rows="5" id="gridUsuario">
			
			<p:column>
				
				<f:facet name="header">
					<h:outputText value="Nome" />
				</f:facet>
				<h:outputText value="#{usuario.nome}" />
			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Email" />
				</f:facet>
				<h:outputText value="#{usuario.email}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Data" />
				</f:facet>
				<h:outputText pattern="dd/MM/yyyy" value="#{usuario.nascimento}" />
			</p:column>

			<p:column>
				<f:facet name="header">
					<h:outputText value="Alterar" />
				</f:facet>

			</p:column>
			<p:column>
				<f:facet name="header">
					<h:outputText value="Excluir" />
				</f:facet>
				<h:commandLink action="#{usuarioBean.excluir}" value="Excluir" />

			</p:column>
		</p:dataTable>
	</h:form>

</h:body>
</html>